import { source } from '../services/component';


export default {

  namespace: 'mycourse',

  state: {

  },

  subscriptions: {
    setup({ dispatch, history }) {
      history.listen(({pathname, query}) => {
        if (pathname.toString() == "/selfinfo/mycourse") {
          dispatch({type: 'study'});
        }
      })
    }
  },

  effects: {
    //学习
    *study({payload}, { call, put, select }) {

      console.log('学习');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

    //考试
    *examination({payload}, { call, put, select }) {

      console.log('考试');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

    //问答
    *QandA({payload}, { call, put, select }) {

      console.log('问答');

      yield put({
        type: 'success',
        payload: {

        }
      })
    },

  },

  reducers: {
    success(state, action){
      return {...state, ...action.payload};
    }
  }
};
